package leetcode.D400.T343;

/**
 * @Author: 18362
 * @Create: 2022-04-10 21:51:33 星期日
 */
class Solution {
    public int integerBreak(int n) {
        int[] dp = new int[n+1];
        dp[1] = 1;
        for (int i=2; i<=n; ++i) {
            for (int j=1; j<i; ++j) {
                int t = Math.max(j*(i-j), j*dp[i-j]);
                dp[i] = Math.max(dp[i], t);
            }
        }
        return dp[n];
    }
}